﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using MsTestUtilities.SolutionAnalysis;
using System.Linq;

namespace MsTestUtilitiesTests.SolutionAnalysisTests.SolutionTests.ProjectParsing
{
    [TestClass]
    public class SingleProjectParsingTests : SolutionParsingFixture
    {
        private const string Header = @"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Express 2013 for Windows Desktop
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project(""{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}"") = ""OnlyProject"", ""OnlyProject\OnlyProject.csproj"", ""{2A0E568C-7D12-4CCC-B806-E3E047883890}""
EndProject

";
        protected override string SolutionFileText
        {
	        get { return Header; }
        }
        
        [TestMethod]
        public void SolutionHasOneProject()
        {            
            Assert.AreEqual(1, SolutionFile.Entries.Count());
        }

        [TestMethod]
        public void ProjectName()
        {
            Assert.AreEqual("OnlyProject", SolutionFile.Entries.First().Name);
        }

        [TestMethod]
        public void RelativeProjectPath()
        {
            Assert.AreEqual(@"OnlyProject\OnlyProject.csproj", SolutionFile.Entries.First().RelativePath);
        }

        [TestMethod]
        public void ProjectId()
        {
            Assert.AreEqual(new Guid("{2A0E568C-7D12-4CCC-B806-E3E047883890}"), SolutionFile.Entries.First().Id);
        }

        [TestMethod]
        public void EntryTypeTest()
        {
            Assert.AreEqual(EntryType.Project, SolutionFile.Entries.First().Type);
        }
    }
}
